package com.d3works.apps.purchase.script;

import com.d3works.apps.purchase.db.PurchaseOrderLine;
import com.d3works.apps.purchase.service.PurchaseOrderLineService;
import com.d3works.exception.D3worksException;
import com.d3works.inject.Beans;
import java.util.Map;

public class ImportPurchaseOrderLine {

  public Object importPurchaseOrderLine(Object bean, Map<String, Object> values)
      throws D3worksException {
    assert bean instanceof PurchaseOrderLine;

    PurchaseOrderLine purchaseOrderLine = (PurchaseOrderLine) bean;
    PurchaseOrderLineService purchaseOrderLineService = Beans.get(PurchaseOrderLineService.class);

    purchaseOrderLineService.compute(purchaseOrderLine, purchaseOrderLine.getPurchaseOrder());
    return purchaseOrderLine;
  }
}
